package com.xi.service;

import com.xi.pojo.*;

import java.util.List;

public interface UserService {
    /*
     * 用户登录
     * */
    Log login(User user);

    /*
     * 用户分页展示
     * */
    PageResult page(UserQueryParam userQueryParam);

    /*
    * 根据id删除用户
    * */
    void deleteById(Integer id);

    /*
    * 获取总用户数
    * */
    Integer count();

    PageResult<Book> page(UserBookQueryParam userBookQueryParam);

    void addUser(User user);

    List<Borrowable> searchBorrowBook();

    boolean checkUserExists(String username);

    User getCurrentUser(String username);

    boolean borrowBook(Integer userId, Integer bookId);

    List<Borrowable> searchBorrowBookByUserId(Integer userId);

    boolean returnBook(Integer userId, Integer bookId);

    boolean renewBook(Integer userId, Integer bookId);

    boolean reserveBook(Integer userId, Integer bookId, String username);
    List<Reservation> getReservationsByUserId(Integer userId);

    boolean cancelReservation(Integer reservationId);


    boolean updateUserInfo(User user);

    boolean updateUserInfo(String oldUsername, String newUsername, String realName, String phone);

    boolean changePassword(String username, String oldPassword, String newPassword);


    Borrow getBorrowRecord(Integer id, Integer bookId);
}
